home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Fading / Morph.s < prev    next >
Encoding:
Text File  |  1998-08-03  |  3.7 KB  |  152 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Fades in a 32 colour picture, then fades it into a second purple palette,
  3. ;and then out to black.  Press left mouse button to exit.
  4.  
  5.     INCDIR    "INCLUDES:"
  6.     INCLUDE    "dpkernel/dpkernel.i"
  7.  
  8.     SECTION    "Demo",CODE
  9.  
  10. ;===========================================================================;
  11. ;                             INITIALISE DEMO
  12. ;===========================================================================;
  13.  
  14.     STARTDPK
  15.  
  16. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  17.     move.l    DPKBase(pc),a6
  18.     lea    PicFile(pc),a0
  19.     moveq    #ID_PICTURE,d0
  20.     CALL    Load
  21.     move.l    d0,Picture
  22.     beq.s    .Exit
  23.  
  24.     moveq    #ID_SCREEN,d0
  25.     CALL    Get
  26.     move.l    d0,Screen
  27.     beq.s    .Exit
  28.  
  29.     move.l    Picture(pc),a0
  30.     move.l    Screen(pc),a1
  31.     CALL    CopyStructure
  32.  
  33.     move.l    Screen(pc),a0
  34.     move.l    GS_Bitmap(a0),a1
  35.     move.l    #BMF_BLANKPALETTE,BMP_Flags(a1)
  36.     sub.l    a1,a1
  37.     CALL    Init
  38.     tst.l    d0
  39.     beq.s    .Exit
  40.  
  41.     move.l    Picture(pc),a0
  42.     move.l    PIC_Bitmap(a0),a0
  43.     move.l    Screen(pc),a1
  44.     move.l    GS_Bitmap(a1),a1
  45.     CALL    Copy
  46.  
  47.     move.l    Screen(pc),a0
  48.     CALL    Show
  49.  
  50.     bsr.s    Main
  51.  
  52. .Exit    move.l    DPKBase(pc),a6
  53.     move.l    Screen(pc),a0
  54.     CALL    Free
  55.     move.l    Picture(pc),a0
  56.     CALL    Free
  57.     MOVEM.L    (SP)+,A0-A6/D1-D7
  58.     moveq    #ERR_OK,d0
  59.     rts
  60.  
  61. ;===========================================================================;
  62. ;                                MAIN CODE
  63. ;===========================================================================;
  64.  
  65. Main:    moveq    #$00,d7    ;d0 = FadeState
  66.     move.l    Screen(pc),a0
  67.     move.l    GS_Bitmap(a0),a5
  68.     move.l    SCRBase(pc),a6
  69. .f_in    CALL    scrWaitAVBL
  70.     move.l    Screen(pc),a0
  71.     move.l    Picture(pc),a1
  72.     move.l    PIC_Bitmap(a1),a1
  73.     move.l    BMP_Palette(a1),a1    ;a1 = Palette to fade to.
  74.     addq.w    #8,a1
  75.     moveq    #5,d1    ;d1 = Speed of fade.
  76.     moveq    #$000000,d2
  77.     moveq    #00,d3
  78.     move.l    BMP_AmtColours(a5),d4
  79.     move.w    d7,d0
  80.     CALL    scrColourToPalette    ;Do the fade routine.
  81.     move.w    d0,d7    ;Has the fade finished yet?
  82.     bne.s    .f_in    ;If not, keep doing it.
  83.  
  84.     move.l    DPKBase(pc),a6
  85.     moveq    #50,d0
  86.     CALL    WaitTime
  87.  
  88.     moveq    #$00,d7    ;d0 = FadeState
  89.     move.l    SCRBase(pc),a6
  90. .f_mid    CALL    scrWaitAVBL
  91.     move.l    Screen(pc),a0
  92.     moveq    #2,d1    ;d1 = Speed of fade.
  93.     move.l    Picture(pc),a1
  94.     move.l    PIC_Bitmap(a1),a1
  95.     move.l    BMP_Palette(a1),a1    ;a1 = Palette to fade to.
  96.     addq.w    #8,a1
  97.     lea    MorphPalette(pc),a2    ;a2 = Destination Palette.
  98.     move.w    d7,d0
  99.     CALL    scrPaletteMorph    ;Do the fade routine.
  100.     move.w    d0,d7    ;Has the fade finished yet?
  101.     bne.s    .f_mid    ;If not, keep doing it.
  102.  
  103.     move.l    DPKBase(pc),a6
  104.     moveq    #50,d0
  105.     CALL    WaitTime
  106.  
  107.     moveq    #$00,d7    ;d0 = FadeState
  108.     move.l    SCRBase(pc),a6
  109. .f_out    CALL    scrWaitAVBL
  110.     move.l    Screen(pc),a0
  111.     moveq    #2,d1    ;d1 = Speed of fade.
  112.     lea    MorphPalette(pc),a1
  113.     moveq    #$000000,d2
  114.     move.w    d7,d0
  115.     CALL    scrPaletteToColour    ;Do the fade routine.
  116.     move.w    d0,d7    ;Has the fade finished yet?
  117.     bne.s    .f_out    ;If not, keep doing it.
  118.  
  119.     move.l    DPKBase(pc),a6
  120.     moveq    #25,d0
  121.     CALL    WaitTime
  122.     rts
  123.  
  124. ;===========================================================================;
  125. ;                                  DATA
  126. ;===========================================================================;
  127.  
  128. Screen:    dc.l    0
  129. Picture    dc.l    0
  130.  
  131. MorphPalette:
  132.     dc.l    $000000,$0A0107,$14020E,$1D0314
  133.     dc.l    $27041B,$310522,$3B0629,$45082F
  134.     dc.l    $4E0936,$580A3D,$620B44,$6C0C4A
  135.     dc.l    $760D51,$800E58,$890F5F,$931066
  136.     dc.l    $9D116C,$A71273,$B1137A,$BA1481
  137.     dc.l    $C41687,$CE178E,$D81895,$E2199C
  138.     dc.l    $EB1AA2,$F51BA9,$FF1CB0,$D71C9F
  139.     dc.l    $557D55,$707082,$443300,$1E1E1E
  140.  
  141. PicFile    FILENAME "GMS:demos/data/PIC.Loading"
  142.  
  143. ;===========================================================================;
  144.  
  145. ProgName:    dc.b  "Palette Morph",0
  146. ProgAuthor:    dc.b  "Paul Manias",0
  147. ProgDate:    dc.b  "January 1998",0
  148. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  149. ProgShort:    dc.b  "Fading demonstration.",0
  150.         even
  151.  
  152.